<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="字典管理" bodyClass="white-bg"/>
<div class="wrapper wrapper-content ibox-content">
<@f.form id="form-type-edit" class="form-horizontal">
	<@f.hidden  id="id" name="id" value="${dictHtml.id}"/>
	<@f.hidden  id="appNo" name="appNo" value="${dictHtml.appNo}"/>
	<div class="form-group">
		<label class="col-sm-3 control-label">${i18n("所属应用编码")}：</label>
		<div class="col-sm-8">
			<@f.plaintext value="${dictHtml.appNo}"/>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-3 control-label ">${i18n("应用名称")}：</label>
		<div class="col-sm-8">
			<@f.plaintext value="${dictHtml.appName}"/>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-3 control-label ">${i18n("字典名称")}：</label>
		<div class="col-sm-8">
			<@f.input name="dictName" value="${dictHtml.dictName}"  required=true/>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-3 control-label">${i18n("字典类型")}：</label>
		<div class="col-sm-8">
			<@f.input name="dictType" value="${dictHtml.dictType}"  required=true 
			helpTip="${i18n('统一规范:请务必使用小写字母下划线定义,页面获取:{0}{1}{2}',['${','dict.getType(\"sys_yes_no\")','}'])}"/>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-3 control-label">${i18n("系统内置")}：</label>
		<div class="col-sm-8">
			<@f.radio name="isSys" value="${dictHtml.isSys}" dictType="sys_yes_no"/>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-3 control-label">${i18n("状态")}：</label>
		<div class="col-sm-8">
			<@f.radio name="status" value="${dictHtml.status}" dictType="sys_normal_disable"/>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-3 control-label">${i18n("备注")}：</label>
		<div class="col-sm-8">
			<@f.textarea name="remark" value="${dictHtml.remark?default('')}"/>
		</div>
	</div>
</@f.form>
</div>
<@footer>
<script>
	var prefix = baseURL + "sys/dict";

	$("#form-type-edit").validate({
		onkeyup: false,
		rules:{
			dictType:{
				minlength: 5,
				remote: {
					url: prefix + "/checkDictTypeUnique",
					type: "POST",
					dataType: "html",
					data: {
						id : function() {
							return $("#dictId").val();
						},
						appNo : function() {
							return $("#appNo").val();
						},
						dictType : function() {
							return opt.common.trim($("#dictType").val());
						}
					},
					dataFilter: function(data, type) {
						return opt.validate.unique(data);
					}
				}
			},
		},
		messages: {
			"dictType": {
				remote: "${i18n("已经存在")}"
			}
		},
		focusCleanup: true
	});

	function submitHandler() {
		if (opt.validate.form()) {
			opt.operate.save(prefix + "/edit", $('#form-type-edit').serialize());
		}
	}
</script>
</@footer>
</@pageTheme>